/* Includes ------------------------------------------------------------------*/
#include <rtthread.h>

#include "stm32f1xx_hal.h"
#include "gpio.h"
#include "uart.h"

struct rt_semaphore sem;

#define THREAD_STACK_SIZE 512
#define THREAD_PRIORITY   2
#define THREAD_TIMESLICE  20

/* ?????????? */
static rt_thread_t tid1 = RT_NULL;
static rt_thread_t tid2 = RT_NULL;

void yield_test1(void* parameter)
{
    rt_uint32_t count = 0;
    while(1)
    {
        rt_kprintf("thread test1 count:%d\n",count++);
        rt_thread_yield();
    }
}
void yield_test2(void* parameter)
{
    rt_uint32_t count = 0;
    while(1)
    {
        rt_kprintf("thread test2 count:%d\n",count++);
        rt_thread_yield();
    }
}

int main()
{
    tid1 = rt_thread_create("yield1",yield_test1,RT_NULL,1024,10,5);
    if(tid1 != RT_NULL)
        rt_thread_startup(tid1);
    tid2 = rt_thread_create("yield2",yield_test2,RT_NULL,1024,10,5);
    if(tid2 != RT_NULL)
        rt_thread_startup(tid2);
    return 0;
}




